#!/bin/bash



# 获取当前IP地址


# 读取 env
MYID_FILE="./zookeeper/data/myid"

source .env

echo  -e "环境变量获取到 KAFKA_BROKER_ID   $BROKER_ID，将其写入到 $MYID_FILE  \n"

# 写入到myid
 echo "$BROKER_ID" >  "$MYID_FILE"


# IPADRESS=$(hostname -I | awk '{print $1}')
# echo "获取服务器IP  $IPADRESS"

# if grep -q "OUTSIDE" .env;  then
#     sed -i  "s/\(OUTSIDE=\).*/\1$IPADRESS/"  .env
#     echo ".env 修改OUTSIDE变量，赋值  $IPADRESS"
# else
#     echo "OUTSIDE=$IPADRESS" >> .env
#     echo ".env 创建OUTSIDE变量，赋值  $IPADRESS"
# fi


# 执行yaml
echo  -e "  执行 yaml ，启动容器相关"

docker-compose up -d

sleep 5

docker-compose ps